/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gui;

import java.util.List;

import com.beans.Projets;
import com.metier.ProjetMetier;

/**
 *
 * @author massaer
 */
public class PanelMesProjets extends javax.swing.JPanel {

    /**
     * Creates new form PanelMesProjets
     */
    public PanelMesProjets() {
        //initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    public void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        tableMesProjets = new javax.swing.JTable();

        ProjetMetier projetsMetier = new ProjetMetier();
		List<Projets> mesProjets = projetsMetier.mesProjets(this.getUsrId());
		int nombreLigne = mesProjets.size();
		Object data[][] = new Object[nombreLigne][5];

		for (int i = 0; i < nombreLigne; i++) {
			Projets proj = mesProjets.get(i);
			data[i][0] = proj.getProjetNum();
			data[i][1] = proj.getProjetRef();
			data[i][2] = proj.getProjetEtat();
			data[i][3] = proj.getProjetClient();
			data[i][4] = proj.getProjetDesc();
		}
		tableMesProjets.setModel(new javax.swing.table.DefaultTableModel(data,
				new String[] { "Numéro", "Référence", "Etat", "Client",
						"Description" }));
		jScrollPane1.setViewportView(tableMesProjets);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 1050, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 450, Short.MAX_VALUE)
        );
    }// </editor-fold>                        
    // Variables declaration - do not modify                     
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable tableMesProjets;
    private long usrId;
    // End of variables declaration  
	public javax.swing.JScrollPane getjScrollPane1() {
		return jScrollPane1;
	}

	public void setjScrollPane1(javax.swing.JScrollPane jScrollPane1) {
		this.jScrollPane1 = jScrollPane1;
	}

	public javax.swing.JTable getTableMesProjets() {
		return tableMesProjets;
	}

	public void setTableMesProjets(javax.swing.JTable tableMesProjets) {
		this.tableMesProjets = tableMesProjets;
	}

	public long getUsrId() {
		return usrId;
	}

	public void setUsrId(long usrId) {
		this.usrId = usrId;
	}
    
}
